#!/bin/bash

url="https://psbdmp.ws"$(curl "https://psbdmp.ws/daily" 2>/dev/null \
	| egrep -o "/daily/[0-9]{4,7}" \
	| head -1)

links=$(curl $url 2>/dev/null \
	| egrep -o "https://pastebin.com/[a-zA-Z0-9]{8}" \
	| sed 's/com\//&raw\//g')

SAVEIFS=$IFS 
IFS=$'\n'  read -r -a array <<< "$links"
IFS=$SAVEIFS   # Restore IFS

for link in $links
do 
	echo "working on $link"
	curl "$link" 2>/dev/null >> collection.txt
done 
